package com.orange.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.orange.handler.impl.SchoolDataServiceImpl;
import com.orange.modules.bean.school_data.AuthMoneyExport;
import com.orange.modules.bean.school_data.AuthResourceExport;
import com.orange.modules.bean.school_data.AuthSchoolRunningExport;
import com.orange.modules.bean.school_data.AuthStudentExport;
import com.orange.modules.bean.school_data.AuthTeacherExport;
import com.orange.modules.bean.school_data.AuthTeacherResouceExport;
import com.orange.modules.entity.school_data.AuthInspectionCollect;
import com.orange.modules.entity.school_data.AuthItemData;
import com.orange.util.ExcelExport;
import com.orange.util.ReturnCode;
import com.orange.util.TimeUtil;

@Controller
@RequestMapping("/schoolData")
public class SchoolDataController extends BaseController {
	private static final Logger log = Logger
			.getLogger(AuthSchoolContactsController.class);
	@Autowired
	private SchoolDataServiceImpl schoolDataServiceImpl;

	
	/**
	 * 办学数据导出excel
	 * @param request
	 * @param response
	 * @param major
	 * @return
	 */
	@RequestMapping(value = "/exportSchoolRunning",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ResponseEntity<String> exportSchoolRunning(HttpServletRequest request, HttpServletResponse response,@RequestParam String major) {
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业类型为空");
		}

		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校名称");
		list.add("学校创办时间");
		list.add("学校合并或重组时间");
		list.add("学校由中师升格专科时间");
		list.add("学校由专科升格本科时间");
		list.add("本科专业开办时间");
		list.add("专科专业开办时间");
		list.add("专业");
		listdata.add(list);

		String filename = "基本状态数据统计报表(表一：办学数据)";

		try {
			List<AuthSchoolRunningExport> resultdata = schoolDataServiceImpl.queryAuthSchoolRunning(major);

			for (AuthSchoolRunningExport info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSname() == null ? " " : info.getSname());
				listeach.add(info.getSchoolStartTime() == null ? " " : info.getSchoolStartTime());
				listeach.add(info.getReorganizationTime() == null ? " " : info.getReorganizationTime());
				listeach.add(info.getSchoolUpgradedCollegeTime() == null ? " ": info.getSchoolUpgradedCollegeTime());
				listeach.add(info.getUndergraduateSchoolTime() == null ? " ": info.getUndergraduateSchoolTime());
				listeach.add(info.getUndergraduateProfessionalStartTime() == null ? " ": info.getUndergraduateProfessionalStartTime());
				listeach.add(info.getSpecialtyStartupTime() == null ? " ": info.getSpecialtyStartupTime());
				listeach.add(info.getLoginType() == null ? " " : info.getLoginType());
				listdata.add(listeach);
			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	
	
	/**
	 * 学生数据导出excel
	 * @param request
	 * @param response
	 * @param major
	 * @return
	 */
	@RequestMapping(value = "/exportAuthStudent",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ResponseEntity<String> exportAuthStudent(HttpServletRequest request, HttpServletResponse response,@RequestParam String major) {
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业类型为空");
		}

		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校名称");
		list.add("本专业已毕业学生数");
		list.add("本专业已毕业学生数(本科专业)");
		list.add("本专业已毕业学生数(专科专业)");
		list.add("全校(院)在校学生数");
		list.add("全校(院)在校学生数(本科专业)");
		list.add("全校(院)在校学生数(专科专业)");
		list.add("本专业在校学生数");
		list.add("本专业在校学生数(本科专业)");
		list.add("本专业在校学生数(专科专业)");
		list.add("本专业在校学生数(男生)");
		list.add("本专业在校学生数(女生)");
		list.add("上年应届生获得相关教师资格证书比例");
		list.add("上年毕业生到相关教育机构初次就业率");
		list.add("上年毕业生跟踪调查用人单位满意率");
		list.add("专业");
		listdata.add(list);

		String filename = "基本状态数据统计报表(表二：学生数据)";

		try {
			List<AuthStudentExport> resultdata = schoolDataServiceImpl.queryAuthStudentData(major);

			for (AuthStudentExport info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSname() == null ? " " : info.getSname());
				listeach.add(info.getGraduatedStudents() == null?" ":info.getGraduatedStudents());
				listeach.add(info.getGraduatedUndergraduateMajor() == null?" ":info.getGraduatedUndergraduateMajor());
				listeach.add(info.getGraduatedSpecializedSubject() == null?" ":info.getGraduatedSpecializedSubject());
				listeach.add(info.getSchoolAllStudents() == null?" ":info.getSchoolAllStudents());
				listeach.add(info.getAllUndergraduateMajor() == null?" ":info.getAllUndergraduateMajor());
				listeach.add(info.getAllSpecializedSubject() == null?" ":info.getAllSpecializedSubject());
				listeach.add(info.getInschoolStudents() == null?" ":info.getInschoolStudents());
				listeach.add(info.getInschoolUndergraduateMajor() == null?" ":info.getInschoolUndergraduateMajor());
				listeach.add(info.getInschoolSpecializedSubject() == null?" ":info.getInschoolSpecializedSubject());
				listeach.add(info.getInschoolboy() == null?" ":info.getInschoolboy());
				listeach.add(info.getInschoolgirl() == null?" ":info.getInschoolgirl());
				listeach.add(info.getTeacherQualificationCertificate() == null?" ":info.getTeacherQualificationCertificate());
				listeach.add(info.getRelevantEducationalInstitutions() == null?" ":info.getRelevantEducationalInstitutions());
				listeach.add(info.getEmployingUnits() == null?" ":info.getEmployingUnits());
				listeach.add(info.getLogintype());
				listdata.add(listeach);
			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	
	/**
	 * 教师数据导出excel
	 * @param request
	 * @param response
	 * @param major
	 * @return
	 */
	@RequestMapping(value = "/exportAuthTeacher",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ResponseEntity<String> exportAuthTeacher(HttpServletRequest request, HttpServletResponse response,@RequestParam String major) {
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业类型为空");
		}

		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校名称");
		list.add("专业");
		list.add("全校(院)专任教师数");
		list.add("全校(院)专任教师数(在编教师数)");
		list.add("全校(院)专任教师数( 编外教师数)");
		list.add("本专业专任教师数");
		list.add("本专业专任教师数(在编教师数 )");
		list.add("本专业专任教师数(编外教师数 )");
		list.add("全校（院）高学历专任教师数");
		list.add("全校（院）高学历专任教师数(博士学位教师数)");
		list.add("全校（院）高学历专任教师数(硕士学位教师数)");
		list.add("全校（院）高学历专任教师数(在读博士学位教师数)");
		list.add("全校（院）高学历专任教师数(在读硕士学位教师数)");
		list.add("专任教师中硕士博士的比例");
		list.add("本专业高学历专任教师数");
		list.add("本专业高学历专任教师数(拥有博士学位人数)");
		list.add("本专业高学历专任教师数(在读博士生人数)");
		list.add("本专业高学历专任教师数(拥有硕士学位人数)");
		list.add("本专业高学历专任教师数(在读硕士生人数)");
		list.add("全校（院）专任教师中高级职称人数");
		list.add("全校（院）专任教师中高级职称人数(教授)");
		list.add("全校（院）专任教师中高级职称人数(副教授)");
		list.add("本专业专任教师中高级职称人数");
		list.add("本专业专任教师中高级职称人数(教授)");
		list.add("本专业专任教师中高级职称人数(副教授)");
		list.add("本专业专任教师中高级职称人数(讲师)");
		list.add("有一年中小学幼儿园教育经历教师数");
		list.add("无中小学幼儿园教育经历教师数");
		list.add("选聘一线优秀教师为兼职教师数");
		listdata.add(list);

		String filename = "基本状态数据统计报表(表三：教师数据)";

		try {
			List<AuthTeacherExport> resultdata = schoolDataServiceImpl.queryAuthTeacherData(major);

			for (AuthTeacherExport info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSname() == null ? " " : info.getSname());
				listeach.add(info.getLogintype());
				listeach.add(info.getFulltimeTeacherNum() ==null ? " " : info.getFulltimeTeacherNum());
				listeach.add(info.getSchoolSeriesNum() ==null ? " " : info.getSchoolSeriesNum());
				listeach.add(info.getSchoolPrivatdozentNum() ==null ? " " : info.getSchoolPrivatdozentNum());
				listeach.add(info.getProfessionalFulltimeTeacherNum() ==null ? " " : info.getProfessionalFulltimeTeacherNum());
				listeach.add(info.getProfessionalSeriesNum() ==null ? " " : info.getProfessionalSeriesNum());
				listeach.add(info.getProfessionalPrivatdozentNum() ==null ? " " : info.getProfessionalPrivatdozentNum());
				listeach.add(info.getHigherEducationFulltimeTeacherNum() ==null ? " " : info.getHigherEducationFulltimeTeacherNum());
				listeach.add(info.getDoctoralTeachersNum() ==null ? " " : info.getDoctoralTeachersNum());
				listeach.add(info.getMasterTeachersNum() ==null ? " " : info.getMasterTeachersNum());
				listeach.add(info.getReadingDoctoralTeachersNum() ==null ? " " : info.getReadingMasterTeachersNum());
				listeach.add(info.getReadingMasterTeachersNum() ==null ? " " : info.getReadingMasterTeachersNum());
				listeach.add(info.getMasterRatio() ==null ? " " : info.getMasterRatio());
				listeach.add(info.getHighProfessionalEducationFulltimeTeacherNum() ==null ? " " : info.getHighProfessionalEducationFulltimeTeacherNum());
				listeach.add(info.getDoctoralDegreeNum() ==null ? " " : info.getDoctoralDegreeNum());
				listeach.add(info.getReadingDoctoralNum() ==null ? " " : info.getReadingDoctoralNum());
				listeach.add(info.getMasterDegreeNum() ==null ? " " : info.getMasterDegreeNum());
				listeach.add(info.getReadingMasterNum() ==null ? " " : info.getReadingMasterNum());
				listeach.add(info.getSeniorFulltimeTeacherNum() ==null ? " " : info.getSeniorFulltimeTeacherNum());
				listeach.add(info.getSchoolProfessorNum() ==null ? " " : info.getSchoolProfessorNum());
				listeach.add(info.getSchoolAssociateProfessorNum() ==null ? " " : info.getSchoolAssociateProfessorNum());
				listeach.add(info.getProfessionalHigherFulltimeTeacherNum() ==null ? " " : info.getProfessionalHigherFulltimeTeacherNum());
				listeach.add(info.getProfessionalProfessorNum() ==null ? " " : info.getProfessionalProfessorNum());
				listeach.add(info.getProfessionalAssociateProfessorNum() ==null ? " " : info.getProfessionalAssociateProfessorNum());
				listeach.add(info.getProfessionalLecturerNum() ==null ? " " : info.getProfessionalLecturerNum());
				listeach.add(info.getOneyearKindergartenTeachersNum() ==null ? " " : info.getOneyearKindergartenTeachersNum());
				listeach.add(info.getNoyearKindergartenTeachersNum() ==null ? " " : info.getNoyearKindergartenTeachersNum());
				listeach.add(info.getExcellentTeachersNum() ==null ? " " : info.getExcellentTeachersNum());
				listdata.add(listeach);
			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	
	/**
	 * 资源数据导出excel
	 * @param request
	 * @param response
	 * @param major
	 * @return
	 */
	@RequestMapping(value = "/exportAuthResource",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ResponseEntity<String> exportAuthResource(HttpServletRequest request, HttpServletResponse response,@RequestParam String major) {
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业类型为空");
		}

		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校名称");
		list.add("学校藏书总量(纸质图书/册)");
		list.add("可供学生免费阅读的电子图书(册)");
		list.add("相关专业图书数量(册)");
		list.add("生均相关专业图书(册)");
		list.add("学生必读书目推荐(册)");
		list.add("生均年图书流通率(%)");
		list.add("学校阅览室期刊数量(种)");
		list.add("可供学生免费阅读电子期刊(种)");
		list.add("可供学生使用的数字化资源(G)");
		list.add("专业期刊数量(种)");
		list.add("教育教学技能实训用房面积(㎡)");
		list.add("其中：共享面积");
		list.add("技能实训用房种类(个)");
		list.add("其中：共享用房");
		list.add("技能实训设施设备原值(元)");
		list.add("其中：共享设备值");
		list.add("专业");
		listdata.add(list);

		String filename = "基本状态数据统计报表(表四：资源数据)";

		try {
			List<AuthResourceExport> resultdata = schoolDataServiceImpl.queryAuthResouceData(major);

			for (AuthResourceExport info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSname() == null ? " " : info.getSname());
				listeach.add(info.getTotalLibraryCollection() == null ? " ": info.getTotalLibraryCollection());
				listeach.add(info.getElectronicBooks() == null ? " " : info.getElectronicBooks());
				listeach.add(info.getRelatedProfessionalBooks() == null ? " ": info.getRelatedProfessionalBooks());
				listeach.add(info.getStudentRelatedProfessionalBooks() == null ? " ": info.getStudentRelatedProfessionalBooks());
				listeach.add(info.getRecommendedBook() == null ? " " : info.getRecommendedBook());
				listeach.add(info.getAverageAnnualBook() == null ? " " : info.getAverageAnnualBook());
				listeach.add(info.getReadingroomJournals() == null ? " " : info.getReadingroomJournals());
				listeach.add(info.getStudentsFreeReading() == null ? " " : info.getStudentsFreeReading());
				listeach.add(info.getStudentsDigitalResources() == null ? " ": info.getStudentsDigitalResources());
				listeach.add(info.getProfessionalJournals() == null ? " ": info.getProfessionalJournals());
				listeach.add(info.getSkillsTrainingRoomArea() == null ? " ": info.getSkillsTrainingRoomArea());
				listeach.add(info.getSharedArea() == null ? " " : info.getSharedArea());
				listeach.add(info.getSkillsTrainingRoomTypes() == null ? " ": info.getSkillsTrainingRoomTypes());
				listeach.add(info.getSharedRoom() == null ? " " : info.getSharedRoom());
				listeach.add(info.getEquipmentCost() == null ? " " : info.getEquipmentCost());
				listeach.add(info.getSharedDeviceValue() == null ? " " : info.getSharedDeviceValue());
				listeach.add(info.getLoginType() == null ? " " : info.getLoginType());
				listdata.add(listeach);
			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	

	/**
	 * 教学数据导出excel
	 * @param request
	 * @param response
	 * @param major
	 * @return
	 */
	@RequestMapping(value = "/exportAuthTeacherResource",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ResponseEntity<String> exportAuthTeacherResource(HttpServletRequest request, HttpServletResponse response,@RequestParam String major) {
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业类型为空");
		}

		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校名称");
		list.add("专业");
		list.add("最新专业建设规划起止年限");
		list.add("最新专业培养方案启用时间");
		list.add("本专业必修课门数（门)");
		list.add("本专业选修课门数（门）");
		list.add("网上选课系统启用时间");
		list.add("网上评教系统启用时间");
		list.add("学生评教周期（月/学期/年/学年)");
		list.add("学生评教满意率最近数据（%）");
		list.add("学分制认定办法实施起始时间");
		list.add("公共基础课程学分占比（%）");
		list.add("学科专业课程学分占比（%）)");
		list.add("教师教育课程学分占比（%）");
		list.add("本专业教育实践合作县市区数量（个）");
		list.add("教育实习基地(校/园)数量（个）");
		list.add("教育实习基地平均接待实习生数（人）");
		list.add("保教实践时间总量（周）");
		list.add("教育见习（课时）");
		list.add("教育实习（周）");
		list.add("教育实习安排一般在第几学期");
		list.add("基地指导教师与实习生之比（%）");
		list.add("高校指导教师与实习生之比（%）");
		list.add("学生对专任教师满意率最新数据（%）");
		list.add("学生对兼职教师满意率最新数据（%）");
		listdata.add(list);

		String filename = "基本状态数据统计报表(表五：教学数据)";

		try {
			List<AuthTeacherResouceExport> resultdata = schoolDataServiceImpl.queryAuthTeacherResource(major);

			for (AuthTeacherResouceExport info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSname() == null ? " " : info.getSname());
				listeach.add(info.getLoginType());
				listeach.add(info.getLatestProfessionalConstructionTime() ==null ? " " : info.getLatestProfessionalConstructionTime());
				listeach.add(info.getProfessionalTrainingProgram() ==null ? " " : info.getProfessionalTrainingProgram());
				listeach.add(info.getRequiredCoursesNum() ==null ? " " : info.getRequiredCoursesNum());
				listeach.add(info.getElectiveCoursesNum() ==null ? " " : info.getElectiveCoursesNum());
				listeach.add(info.getOnlineCourseTime() ==null ? " " : info.getOnlineCourseTime());
				listeach.add(info.getOnlineAssessmentTime() ==null ? " " : info.getOnlineAssessmentTime());
				listeach.add(info.getTeachingCycle() ==null ? " " : info.getTeachingCycle());
				listeach.add(info.getTeachingSatisfaction() ==null ? " " : info.getTeachingSatisfaction());
				listeach.add(info.getCreditSystemTime() ==null ? " " : info.getCreditSystemTime());
				listeach.add(info.getBasicCourseCredit() ==null ? " " : info.getBasicCourseCredit());
				listeach.add(info.getProfessionalCourseCredits() ==null ? " " : info.getProfessionalCourseCredits());
				listeach.add(info.getCurriculumCredits() ==null ? " " : info.getCurriculumCredits());
				listeach.add(info.getCountyNum() ==null ? " " : info.getCountyNum());
				listeach.add(info.getPracticeBase() ==null ? " " : info.getPracticeBase());
				listeach.add(info.getEducationalPractice() ==null ? " " : info.getEducationalPractice());
				listeach.add(info.getTeachingPracticeTime() ==null ? " " : info.getTeachingPracticeTime());
				listeach.add(info.getEducationalProbation() ==null ? " " : info.getEducationalProbation());
				listeach.add(info.getEducationPracticeBase() ==null ? " " : info.getEducationPracticeBase());
				listeach.add(info.getEducationalPracticeTime() ==null ? " " : info.getEducationalPracticeTime());
				listeach.add(info.getBaseInstructor() ==null ? " " : info.getBaseInstructor());
				listeach.add(info.getRatioTeacherStudent() ==null ? " " : info.getRatioTeacherStudent());
				listeach.add(info.getFulltimeTeachersLatest() ==null ? " " : info.getFulltimeTeachersLatest());
				listeach.add(info.getParttimeTeachersLatest() ==null ? " " : info.getParttimeTeachersLatest());
				listdata.add(listeach);
			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	
	/**
	 * 经费数据导出excel
	 * @param request
	 * @param major
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/exportAuthMoney",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	public ResponseEntity<String> exportAuthMoney(HttpServletRequest request,@RequestParam String major,HttpServletResponse response) {
		
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业类型为空");
		}
		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校名称");
		list.add("专业");
		list.add("全校(院)上年生均培养经费");
		list.add("本专业上年生均培养经费");
		list.add("最新教育实习经费预算标准");
		list.add("上年教育实习经费支出生均数");
		list.add("全校教师上年培训经费总额占生均教育经费拨款比例");
		list.add("本专业教师上年培训经费支出总额占生均教育经费拨款比例");
		list.add("本专业上年教学设施设备投入生均数");
		list.add("本专业上年专业图书经费投入生均数");
		list.add("本专业学校拨款的教育科研经费生均数");
		listdata.add(list);

		String filename = "基本状态数据统计报表(表六：经费数据)";

		try {
			List<AuthMoneyExport> resultdata = schoolDataServiceImpl.queryAuthMoneyResouce(major);

			for (AuthMoneyExport info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSname() == null ? " " : info.getSname());
				listeach.add(info.getLogintype());
				listeach.add(info.getTrainingFunds() == null ? " " : info.getTrainingFunds());
				listeach.add(info.getProfessionalTrainingFunds() == null ? " ": info.getProfessionalTrainingFunds());
				listeach.add(info.getBudgetStandards() == null ? " " : info.getBudgetStandards());
				listeach.add(info.getWereBorn() == null ? " " : info.getWereBorn());
				listeach.add(info.getAverageEducationFundingRatio() == null ? " ": info.getAverageEducationFundingRatio());
				listeach.add(info.getOutlayPerStudent() == null ? " " : info.getOutlayPerStudent());
				listeach.add(info.getEquipmentInvestment() == null ? " " : info.getEquipmentInvestment());
				listeach.add(info.getProfessionalLibraryFunding() == null ? " ": info.getProfessionalLibraryFunding());
				listeach.add(info.getFundingEducationFundingPer() == null ? " ": info.getFundingEducationFundingPer());
				listdata.add(listeach);

			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	
	/**
	 * 材料评审结果汇总表下载
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/exportAuthItemData",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	public ResponseEntity<String> exportAuthItemData(HttpServletRequest request,@RequestParam String major,HttpServletResponse response) {
		
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业为空");
		}
		
		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("所在院校");
		list.add("申请认证专业");
		list.add("一级指标");
		list.add("二级指标或细则");
		list.add("专家");
		list.add("专家组评议");
		listdata.add(list);

		String filename = "材料评审结果汇总表";

		try {
			List<AuthItemData> resultdata = schoolDataServiceImpl.queryAuthItemExpertData(major);

			for (AuthItemData info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getMajor() == null ?" ":info.getMajor());
				listeach.add(info.getSchoolName() == null ?" ":info.getSchoolName());
				listeach.add(info.getContent() == null ?" ":info.getContent());
				list.add(info.getType() == "0"?"二级指标":"细则");
				listeach.add(info.getExpertName() == null ?" ":info.getExpertName());
				listeach.add(info.getReview() == null ?" ":info.getReview());
				listdata.add(listeach);

			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			log.error(e);
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
	
	/**
	 * 现场考察汇总表下载
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/exportInspectionCollect",produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8", method=RequestMethod.GET)
	@ResponseBody
	public ResponseEntity<String> exportAuthInspectionCollect(HttpServletRequest request,@RequestParam String major,HttpServletResponse response) {
		
		if (major == null || StringUtils.isBlank("major")) {
			return toResponse(null, ReturnCode.PARAMETER_NOT_NULL, "专业为空");
		}
		
		List<String> list = new ArrayList<String>();
		List<List<String>> listdata = new ArrayList<List<String>>();
		list.add("学校");
		list.add("专家组名称");
		list.add("专家姓名");
		list.add("一级指标");
		list.add("模块");
		list.add("编号");
		list.add("具体值");
		listdata.add(list);

		String filename = "现场考察汇总表";

		try {
			List<AuthInspectionCollect> resultdata = schoolDataServiceImpl.queryAuthInspectionCollect(major);

			for (AuthInspectionCollect info : resultdata) {
				List<String> listeach = new ArrayList<String>();
				listeach.add(info.getSchoolName() == null ?" ":info.getSchoolName());
				listeach.add(info.getName() == null ?" ":info.getName());
				listeach.add(info.getContent() == null ?" ":info.getContent());
				listeach.add(info.getExpertName() == null?" ":info.getExpertName());
				listeach.add(info.getMode() == null ?" ":info.getMode());
				listeach.add(info.getKeys() == null ?" ":info.getKeys());
				listeach.add(info.getVal() == null ?" ":info.getVal());
				listdata.add(listeach);

			}
			ExcelExport p = new ExcelExport();
			p.exportXLS(response, listdata, filename);
			return toResponse(null, ReturnCode.SUCCESS, "导出excel成功");
		} catch (Exception e) {
			e.printStackTrace();
			return toResponse(null, ReturnCode.FAIL, "导出excel失败");
		}
	}
}
